package com.zhxl.server.dao;

import java.util.List;
import java.util.Map;

import com.zhxl.server.model.GoodsOrderItem;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.zhxl.server.model.GoodsOrder;

@Mapper
public interface GoodsOrderDao {

    @Select("select * from goods_order t where t.id = #{id}")
    GoodsOrder getById(Long id);



    @Delete("delete from goods_order where id = #{id}")
    int delete(Long id);

    int update(GoodsOrder goodsOrder);
    
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into goods_order(order_num, total, integral, payment, payment_type, post_type, status, create_time, update_time, payment_time, consign_time, end_time, close_time, shipping_name, shipping_code, freight, user_id, receiver_phone, receiver_name, receiver_area_name, after_sales_service, invoice, num, small_pic, type) values(#{orderNum}, #{total}, #{integral}, #{payment}, #{paymentType}, #{postType}, #{status}, #{createTime}, #{updateTime}, #{paymentTime}, #{consignTime}, #{endTime}, #{closeTime}, #{shippingName}, #{shippingCode}, #{freight}, #{userId}, #{receiverPhone}, #{receiverName}, #{receiverAreaName}, #{afterSalesService}, #{invoice}, #{num}, #{smallPic}, #{type})")
    int save(GoodsOrder goodsOrder);
    
    int count(@Param("params") Map<String, Object> params);

    List<GoodsOrder> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);
}
